﻿using System;
using System.Linq.Expressions;
using SBACN.WebSite.Code;
using SBACN.WebSite.Models;

namespace SBACN.WebSite
{
    public partial class Introduction : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            string t = Request.QueryString["t"];
            if (!string.IsNullOrEmpty(t))
            {
                Expression<Func<TB_News, bool>> f = (p => p.Type == t + "0002" && p.IsEn == false);
                var result = DAL.DALHelper.Instance.GetFirstOrDefaultObject<TB_News>(f);
                if (result != null)
                {
                    lblTitle.Text = result.Title;
                    lblData.Text = result.CreateDate.ToString();
                    lblContent.Text = result.Summary;
					hylDown.NavigateUrl = result.AttachmentsUrl;
                }

            }
        }
    }
}